#pragma once
#include <iostream>
#include <xf86drm.h>
#include <xf86drmMode.h>
class LibDrmInitializer
{
  public:
    LibDrmInitializer(std::string drm_device = "/dev/dri/card0");
    ~LibDrmInitializer();
    void setup();
    int createFrameBuffer();
  protected:
    int fd;
    drmModeRes* res;
    drmModeConnector* conn;

    drmModeEncoderPtr encoder;
    drmModeCrtc* crtc;
    drmModeModeInfo crtcMode;


    struct drm_mode_create_dumb create_req = {0};
    struct drm_mode_map_dumb map_req = {0};
    
    uint32_t fb_id;
    uint32_t* mapped_dumb;
};